<?php
defined('IN_IXDCW') or exit('Access Denied');
include tpl('header');
show_menu($menus);
?>
<form action="?">
    <div class="tt">广告位搜索</div>
    <input type="hidden" name="moduleid" value="<?php echo $moduleid;?>"/>
    <input type="hidden" name="file" value="<?php echo $file;?>"/>
    <table cellpadding="2" cellspacing="1" class="tb">
        <tr>
            <td>
                &nbsp;<?php echo $type_select;?>&nbsp;
                <input type="text" size="30" name="kw" value="<?php echo $kw;?>" title="关键词"/>&nbsp;
                宽度：<input type="text" size="3" name="width" value="<?php echo $width;?>"/>&nbsp;
                高度：<input type="text" size="3" name="height" value="<?php echo $height;?>"/>&nbsp;
                <select name="open">
                    <option value="-1"<?php if ($open == -1) echo ' selected';?>>前台</option>
                    <option value="1"<?php if ($open == 1) echo ' selected';?>>显示</option>
                    <option value="0"<?php if ($open == 0) echo ' selected';?>>隐藏</option>
                </select>&nbsp;
                <input type="checkbox" name="thumb" value="1"<?php echo $thumb ? ' checked' : '';?>/>示意图&nbsp;
                <input type="text" name="psize" value="<?php echo $pagesize;?>" size="2" class="t_c" title="条/页"/>
                <input type="submit" value="搜 索" class="btn"/>&nbsp;
                <input type="button" value="重 置" class="btn" onclick="window.location='?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>';"/>
            </td>
        </tr>
    </table>
</form>
<form method="post">
    <div class="tt">管理广告位</div>
    <table cellpadding="2" cellspacing="1" class="tb">
        <tr>
            <th width="25"><input type="checkbox" onclick="checkall(this.form);"/></th>
            <th width="40">排序</th>
            <th>ID</th>
            <th>广告类型</th>
            <th width="15"></th>
            <th>广告位名称</th>
            <th>规格(px)</th>
            <th title="(<?php echo $DT['money_unit'];?>/月)">全国站价格</th>
            <th title="(<?php echo $DT['money_unit'];?>/月)">分站价格</th>

            <th>购买用户</th>
            <th>广告</th>
            <th>HTML调用代码</th>
            <th>操作</th>
        </tr>
		<?php foreach ($places as $k => $v) { ?>
        <tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center" name="编辑:<?php echo $v['editor'];?>&#10;更新时间:<?php echo $v['editdate'];?>">
            <td><input type="checkbox" name="pids[]" value="<?php echo $v['pid'];?>"/></td>
            <td><input type="text" size="2" name="listorder[<?php echo $v['pid'];?>]" value="<?php echo $v['listorder'];?>"/></td>
            <td><?php echo $v['pid'];?></td>
            <td><a href="<?php echo $v['typeurl'];?>" target="_blank"><?php echo $v['typename'];?></td>
            <td><?php if ($v['thumb']) { ?> <a href="javascript:_preview('<?php echo $v["thumb"];?>');"><img src="admin/image/img.gif" width="10" height="10" title="广告位示意图,点击查看" alt=""/></a><?php } ?></td>
            <td align="left" title="添加时间:<?php echo $v['adddate'];?>&#10;编辑:<?php echo $v['editor'];?>&#10;上次修改:<?php echo $v['editdate'];?>"><a href="?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=list&pid=<?php echo $v['pid'];?>"><?php echo $v['name'];?></td>
            <td><?php echo $v['width'];?> x <?php echo $v['height'];?></td>
            <td><?php echo $v['nation_price'] ? $v['nation_price'] . $unit : '不开放';?></td>
            <td><?php echo $v['subnation_price'] ? $v['subnation_price'] . $unit : '不开放';?></td>
            <td>
            <select name="payids[<?php echo $v['pid'];?>]" id="payids<?php echo $v['pid'];?>]">
			<?php if($v['pay']){ ?>
            <?php foreach($v['pay'] as $payValue){ ?>
            <?php echo '<option value ="'.$payValue["payid"].'">'.$payValue["payid"].' '.get_user($payValue["userid"],'userid','username').' '.date("Y-m-d",$payValue["starttime"]).'-'.date("Y-m-d",$payValue["overtime"]).''.'</option>';?>
            <?php } ?>
			<?php }else{ ?>
            <?php echo '<option value ="0">无用户购买</option>无用户购买'; ?>
			<?php } ?>
            </select>
            
            <input type="button" class="btn" onclick="var payid = Dd('payids<?php echo $v['pid'];?>]').value; window.location = '?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=edit_user&pid=<?php echo $v['pid'];?>&payid='+payid" value="编辑用户订单"/>
            </td>
            <td><a href="?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=list&pid=<?php echo $v['pid'];?>"><?php echo $v['ads'];?></a></td>

            <td><input type="text" size="12" <?php if ($v['typeid'] == 6 || $v['typeid'] == 7) { ?>value="{ad($moduleid,$catid,$kw,<?php echo $v['typeid'];?>)}"<?php } else { ?>value="{ad(<?php echo $v['pid'];?>)}"<?php } ?> onmouseover="this.select();"/></td>
            <td>
                <a onclick="var payid = Dd('payids<?php echo $v['pid'];?>]').value; window.location = '?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=add&pid=<?php echo $v['pid'];?>&payid='+payid"><img src="admin/image/new.png" width="16" height="16" title="向此广告位添加广告" alt=""/></a>&nbsp;
                <a onclick="var payid = Dd('payids<?php echo $v['pid'];?>]').value; window.location = '?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=list&pid=<?php echo $v['pid'];?>&payid='+payid"><img src="admin/image/child.png" width="16" height="16" title="此广告位广告列表" alt=""/></a>&nbsp;
                <a onclick="var payid = Dd('payids<?php echo $v['pid'];?>]').value; window.location = '?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=list&job=check&pid=<?php echo $v['pid'];?>&payid='+payid"><img src="admin/image/import.png" width="16" height="16" title="此广告位广告待审核列表" alt=""/></a>&nbsp;
                <a href="?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=price&pid=<?php echo $v['pid'];?>"><img src="admin/image/price.png" width="16" height="16" title="此广告位特殊分站价格" alt=""/></a>&nbsp;
	            <a href="?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=add_user&pid=<?php echo $v['pid'];?>"><img src="admin/image/price.png" width="16" height="16" title="添加此广告位用户" alt=""/></a>&nbsp;
                <a href="?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=view&pid=<?php echo $v['pid'];?>" target="_blank"/><img src="admin/image/view.png" width="16" height="16" title="预览此广告位" alt=""></a>&nbsp;
                <a href="?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=edit_place&pid=<?php echo $v['pid'];?>"><img src="admin/image/edit.png" width="16" height="16" title="修改此广告位" alt=""/></a>&nbsp;
                <a href="?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=delete_place&pids=<?php echo $v['pid'];?>" onclick="return _delete();"><img src="admin/image/delete.png" width="16" height="16" title="删除此广告位" alt=""/></a>
            </td>
        </tr>
		<?php }?>
    </table>
    <div class="btns">
        <input type="submit" value=" 更新排序 " class="btn" onclick="this.form.action='?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=order_place';"/>&nbsp;
        <input type="submit" value=" 删 除 " class="btn" onclick="if(confirm('确定要删除选中广告位吗？\n\n广告位下的所有广告也将被删除\n\n此操作不可撤销\n\n强烈建议不要删除系统自带的广告位')){this.form.action='?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&action=delete_place'}else{return false;}"/>&nbsp;&nbsp;&nbsp;
        提示：系统会定期自动更新广告，如果需要立即看到效果，请点更新广告。如果启用了城市分站，请不要使用JS调用广告
    </div>
</form>
	<div class="pages"><?php echo  $do->getPn()->render();?></br>
	<span>共<?php echo $items;?>条/<?php echo $do->getPn()->getPages();?>页&nbsp;
		<?php if ($do->getPn()->getPages()>1){;?>
		到第</span>
		<input type="text" name="page-num-input" id="xd_page_jump"/>
		<span>页</span>
		<button type="submit" onclick="xdChangeAndLocation('page', $('#xd_page_jump').val())">确定</button>
		<?php };?></div>
<br/>
<script type="text/javascript">Menuon(1);</script>
<?php include tpl('footer'); ?>